#pragma once

#include "dut/WinMin.h"

#include <glm/gtc/matrix_inverse.hpp>
#include <glm/common.hpp>
#include <glm/gtx/euler_angles.hpp>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/matrix_decompose.hpp> 
#include <glm/gtx/matrix_decompose.hpp>


namespace Dut
{
	struct Transform
	{
		glm::vec3 position;
		glm::vec3 rotation;
		glm::vec3 scale;

		Transform();
		glm::vec3 Right();
		glm::vec3 Forward();
		glm::vec3 Up();

		glm::mat4 GetViewMatrix();
		glm::mat4 GetLocalMatrix() const;
		glm::mat4 GetPosRotMatrix() const;

		void SetPosition(const glm::vec3& pos);
		void Decompose(glm::mat4 local);
		void RotateX(float d);
		void RotateY(float d);
		void RotateZ(float d);
		void Rotate(glm::vec3);

		void SetRotation(const glm::quat& q);
		void BackAt(glm::vec3 pos, glm::vec3 worldUp = glm::vec3(0.0f, 1.0f, 0.0f));
		void LookAt(glm::vec3 pos, glm::vec3 worldUp = glm::vec3(0.0f, 1.0f, 0.0f));

		glm::mat4 GetRotationMatrix();

		// ת��quat
		glm::quat GetRoatationQuat();

		void Move(float dist, glm::vec3 f);
		void Translate(float dist);
		void MoveRight(float dist);


		static glm::vec3 GetEulerAnglesFromRotationMatrix(const glm::mat4& rotationMatrix);
		static Transform Slerp(const Transform& t1, const Transform& t2, float axis);
	};

}



